/*
 *  Copyright 2019-2020 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package me.zhengjie.modules.biz.domain;

import io.swagger.annotations.ApiOperation;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
 * @website https://eladmin.vip
 * @description /
 * @author Admin
 * @date 2023-03-13
 **/
@Entity
@Data
@Table(name="hj_cabinet")
public class Cabinet implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`name`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "名称")
    private String name;

    @Column(name = "`lab_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "实验室")
    private Integer labId;

    @Column(name = "`created_at`")
    @CreationTimestamp
    @ApiModelProperty(value = "日期")
    private Timestamp createdAt;

    @Column(name = "`updated_at`")
    @UpdateTimestamp
    @ApiModelProperty(value = "updatedAt")
    private Timestamp updatedAt;

    @Column(name = "`is_deleted`")
    @ApiModelProperty(value = "是否删除")
    private Integer isDeleted;

    @Column(name = "`type`")
    @ApiModelProperty(value = "类型:1.化学品 2.毒品")
    private Integer type;

    @Column(name = "`storehouse_admin_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "storehouseAdminId")
    private Integer storehouseAdminId;

    @Column(name = "`director_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "directorId")
    private Integer directorId;

    @Column(name = "mac")
    @ApiModelProperty(value = "mac")
    private String mac;

    @Column(name = "is_open")
    @ApiModelProperty(value = "isOpen")
    private Integer isOpen;

    @Column(name = "`temperature`")
    @ApiModelProperty(value = "温度")
    private Float temperature;

    @Column(name = "`temperature_threshold_value`")
    @ApiModelProperty(value = "温度阈值")
    private Float temperatureThresholdValue;

    @Column(name = "`humidity`")
    @ApiModelProperty(value = "湿度")
    private Float humidity;

    @Column(name = "`humidity_threshold_value`")
    @ApiModelProperty(value = "湿度阈值")
    private Float humidityThresholdValue;

//    @Column(name = "position")
//    @ApiModelProperty(value = "位置")
//    private String position;


    public void copy(Cabinet source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
